﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Adatkezelo.Classes;

namespace NEMProjectWebApp.Pages.Oktato {
    public partial class tananyagKezeles : System.Web.UI.Page {
        Tananyag_kezelese anyagkezel = new Tananyag_kezelese();
        Login_Kezeles login = new Login_Kezeles();
        protected void Page_Load(object sender, EventArgs e) {
            string redirect = login.BelepesiJogkorEll(Session, 3);
            if (redirect.Length > 0) Response.Redirect(redirect);
        }
        public void dataBinding() {
            //SqlDataSource2.SelectCommand = "select [FileName], TananyagKapcs.Tan_ID" +
            //    " FROM [TananyagKapcs],[Tananyag] " +
            //    " WHERE Targy_ID = " + (!TargyakDropDownList.SelectedValue.Equals("") ? TargyakDropDownList.SelectedValue : "1") +
            //    " AND Tananyag.Tan_ID = TananyagKapcs.Tan_ID";
            AnyagListBox.DataBind();
        }

        protected void feltoltButton_Click(object sender, EventArgs e) {
            anyagkezel.TananyagFeltoltes(TargyakDropDownList.SelectedValue, FileUpload1);
            dataBinding();
        }

        protected void torolButton_Click(object sender, EventArgs e) {
            anyagkezel.TananyagTorol(AnyagListBox.SelectedValue);
            dataBinding();
        }

        protected void TargyakDropDownList_SelectedIndexChanged(object sender, EventArgs e) {
            dataBinding();
        }

        protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e) {

        }
    }
}